﻿<%@ Page Language="C#" AutoEventWireup="true" CodeFile="sysaccounts.aspx.cs" Inherits="qy_54tss_Admin_sysaccounts" %>

<%@ Register Src="~/Admin/Banner.ascx" TagName="TogoBanner" TagPrefix="uc1" %>
<%@ Register Assembly="AspNetPager" Namespace="Wuqi.Webdiyer" TagPrefix="webdiyer" %>
<%@ Register Src="~/Admin/Foot.ascx" TagName="Foot" TagPrefix="uc2" %>
<%@ Register Src="~/Admin/Adleft.ascx" TagName="left" TagPrefix="uc3" %>
<%@ Register TagPrefix="epc" Namespace="Hangjing.Control" Assembly="Hangjing.Control" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
    <title>费用科目管理-<%= WebUtility.GetMyName()%></title>
    <link href="../css/reset.css" rel="stylesheet" type="text/css" />
    <link href="../css/menu.css" rel="stylesheet" type="text/css" />
    <link href="../css/boxes.css" rel="stylesheet" type="text/css" />
    <link href="../css/Validator.css" rel="stylesheet" type="text/css" />
    <link href="../css/Common.css" rel="stylesheet" type="text/css" />
    <!--[if IE]>
    <link rel="stylesheet" type="text/css" href="../css/iestyles.css" media="all" />
    <![endif]-->
    <!--[if lt IE 7]>
    <link rel="stylesheet" type="text/css" href="../css/below_ie7.css" media="all" />
    <![endif]-->
    <!--[if IE 7]>
    <link rel="stylesheet" type="text/css" href="../css/ie7.css" media="all" />
    <![endif]-->
    <link href="../css/shopadmin.css" rel="stylesheet" type="text/css" />
    <link href="../../javascript/jbox/Skins/jbox.css" rel="stylesheet" />

    <script type="text/javascript" src="../javascript/DatePicker/WdatePicker.js"></script>

    <script src="../javascript/jquery-1.3.2.js" type="text/javascript"></script>

    <script src="../javascript/Common.js" type="text/javascript"></script>

    <script src="../javascript/ShowDivDialog.js" type="text/javascript"></script>

    <script language="javascript" type="text/javascript">

        AddLoadFun(init);

        var Table;
        function init() {
            // Table = new CheckTable("rptsubItem");
            $("#rptsubItem tr").mouseover(function () { $(this).addClass("on-mouse"); }).mouseout(function () { $(this).removeClass("on-mouse"); });
            $("#rptsubItem tr:even").addClass("even pointer");
            $("#loading-mask").hide();
            Request =
            {
                QueryString: function (item) {
                    var svalue = location.search.match(new RegExp("[\?\&]" + item + "=([^\&]*)(\&?)", "i"));
                    return svalue ? svalue[1] : svalue;
                }
            }
            $("#A" + Request.QueryString("id")).addClass("active");
        }

        function Del() {
            var nums = Table.GetChecks();
            if (nums == undefined || nums.length == 0) {
                alert("请选择要删除的记录!");
                return false;
            }
            document.getElementById("hdDels").value = ArrayToString(nums);
            return DelConfirm();
        }

        function jDel() {
            var nums = Table.GetChecks();
            if (nums == undefined || nums.length == 0) {
                alert("请选择要操作的记录!");
                return false;
            }
            document.getElementById("hdDels").value = ArrayToString(nums);
            return true;
        }


        function loading() {
            $("#loading-mask").show();
        }

        function loadover() {
            $("#loading-mask").hide();
        }

        function showsub(id, tag) {
            $("._" + id).toggle();
            var img = $(tag).attr("src");
            if (img == "../images/lines/rplus.gif") {
                $(tag).attr("src", "../images/lines/rminus.gif");
            }
            else {
                $(tag).attr("src", "../images/lines/rplus.gif");
            }
        }

    </script>

    <style type="text/css">
        .grid th {
            border: 1px solid #DADFE0;
        }
    </style>
</head>
<body>
    <form id="form1" runat="server">
        <asp:HiddenField ID="hdDels" runat="server" />
        <epc:Hint ID="Hint1" runat="server" HintImageUrl="../images/Control" />
        <div class="wrapper">
            <!--banner start-->
            <uc1:TogoBanner runat="server" ID="Banner" />
            <!--banner end-->
            <!--center start-->
            <div class="middle" id="anchor-content">
                <div id="page:main-container">
                    <div class="columns ">
                        <div class="side-col" id="page:left">
                            <uc3:left runat="server" ID="left" />
                        </div>
                        <div class="main-col" id="content">
                            <asp:ScriptManager ID="ScriptManager1" runat="server">
                            </asp:ScriptManager>
                            <asp:UpdatePanel ID="UpdatePanel1" runat="server">
                                <ContentTemplate>
                                    <div class="main-col-inner">
                                        <div id="divMessages">
                                        </div>

                                      
                                        <div class="scott">
                                            <webdiyer:AspNetPager CssClass="anpager" ID="AspNetPager1" runat="server" Width="100%"
                                                CustomInfoHTML="共有记录 <font>%RecordCount%</font> 条 当前为 <font>%CurrentPageIndex%</font>/<font>%PageCount%</font> 页"
                                                HorizontalAlign="Right" ShowCustomInfoSection="Left" CustomInfoTextAlign="Right"
                                                CustomInfoSectionWidth="28%" ShowPageIndexBox="Always" PageIndexBoxType="TextBox"
                                                TextBeforePageIndexBox="转到 " UrlPagingTarget="_self" UrlPageIndexName="p" UrlPageSizeName="s"
                                                UrlPaging="True" PageIndexBoxClass="flattext" ShowPageIndex="True" PageSize="50"
                                                SubmitButtonClass="flatbutton" SubmitButtonText=" GO " TextAfterPageIndexBox=" 页 "
                                                Wrap="False">
                                            </webdiyer:AspNetPager>
                                        </div>
                                        <div class="grid">
                                            <div class="hor-scroll">
                                                <div align="center" class="hshop_class">
                                                    <label runat="server" id="lbpname" style="font-size: 12px; color: #EA7601;">
                                                        费用科目管理
                                                    </label>
                                                </div>
                                                <div style="margin-bottom: 15px; margin-top:15px;">
                                                    <table class="data" cellspacing="0" id="Table1">
                                                    <col />
                                                    <col width="15%" />
                                                    <col width="20%" />
                                                    <thead>
                                                        <tr class="headings">
                                                            <th>
                                                                <span class="nobr"><a class="not-sort" href="#" name="real_order_id" title="asc"><span
                                                                    class="sort-title">名称</span></a></span>
                                                            </th>
                                                            <th>
                                                                <span class="nobr"><a class="not-sort" href="#" name="NewsFrom" title="asc"><span
                                                                    class="sort-title">排序</span></a></span>
                                                            </th>
                                                            <th class="no-link last">
                                                                <span class="nobr">操作</span>
                                                            </th>
                                                        </tr>
                                                    </thead>
                                                    <tbody class="grid_data">
                                                        <asp:Repeater ID="rtpNewsSortList" runat="server" OnItemCommand="rtpNewsSortList_ItemCommand">
                                                            <ItemTemplate>
                                                                <tr class="pointer" title="">
                                                                    <td class="">
                                                                        <img align="absmiddle" src="../images/lines/rminus.gif" onclick="showsub(<%#Eval("id") %> ,this)"><%# Eval("classname")%>
                                                                    </td>
                                                                    <td class="">
                                                                        <%# Eval("Priority")%>
                                                                    </td>
                                                                    <td class=" last">
                                                                        <a href='javascript:' onclick="startEdit(<%#Eval("Parentid") %>,<%#Eval("id") %>,'<%#Eval("classname") %>',<%#Eval("Priority") %>)">编辑</a>| <a href='javascript:' onclick="startEdit(<%#Eval("id") %>,0)">添加子模块</a> | <asp:LinkButton ID="lbdel" runat="server" CommandArgument='<%# Eval("id") %>'
                                                                                    CommandName="del" OnClientClick="return DelConfirm();">刪除</asp:LinkButton>
                                                                    </td>
                                                                </tr>
                                                                <asp:Repeater ID="rtpsub" runat="server" OnItemCommand="rtpNewsSortList_ItemCommand"
                                                                    DataSource='<%# Eval("sublist") %>'>
                                                                    <ItemTemplate>
                                                                        <tr class="pointer _<%#Eval("Parentid") %>" title="">
                                                                            <td class="">
                                                                                <img align="absmiddle" src="../images/lines/i.gif"><img align="absmiddle" style="padding-left: 10px;"
                                                                                    src="../images/lines/tminus.gif">
                                                                                <a href='javascript:'  onclick="startEdit(<%#Eval("Parentid") %>,<%#Eval("id") %>,'<%#Eval("classname") %>',<%#Eval("Priority") %>)">
                                                                                    <%# Eval("classname")%></a>
                                                                            </td>
                                                                            <td class="">
                                                                                <%# Eval("Priority")%>
                                                                            </td>
                                                                            <td class=" last">  
                                                                              <a href='javascript:' onclick="startEdit(<%#Eval("Parentid") %>,<%#Eval("id") %>,'<%#Eval("classname") %>',<%#Eval("Priority") %>)">编辑</a> | <asp:LinkButton ID="lbdel" runat="server" CommandArgument='<%# Eval("id") %>'
                                                                                    CommandName="del" OnClientClick="return DelConfirm();">刪除</asp:LinkButton>
                                                                            </td>
                                                                        </tr>
                                                                    </ItemTemplate>
                                                                </asp:Repeater>
                                                            </ItemTemplate>
                                                        </asp:Repeater>
                                                    </tbody>
                                                </table>





                                                </div>
                                                <div id="nodata" runat="server" style="display: none;">
                                                    没有任何数据!
                                                </div>
                                                <div align="center" class="hshop_class">
                                                    <label runat="server" id="lbadd" style="font-size: 12px;">
                                                        添加费用科目一级分类
                                                    </label>
                                                </div>
                                                <div style="text-align: center">
                                                    <table style="clear: both; width: 100%; text-align: left;">
                                                        <tr>
                                                            <th style="width: 30%; text-align: left; padding-left: 10px;">科目：<epc:TextBox runat="server" ID="tbclassname"></epc:TextBox>
                                                            </th>
                                                            <th style="width: 30%; text-align: left; padding-left: 10px;">排序：<epc:TextBox Width="60" Text="1" runat="server" ID="tbpri" onkeypress="return only_num(event)"></epc:TextBox>
                                                            </th>
                                                        </tr>
                                                        <tr>
                                                            <th style="width: 20%; text-align: left; padding-left: 10px;">&nbsp;
                                                            </th>
                                                            <td>
                                                                <asp:Button ID="btSave" runat="server" CssClass="button_1" OnClientClick="return IsNull()"
                                                                    OnClick="btSave_Click" Text="保存"></asp:Button>
                                                            </td>
                                                        </tr>
                                                    </table>
                                                </div>
                                            </div>
                                        </div>
                                        <div class="scott">
                                            <webdiyer:AspNetPager runat="server" ID="AspNetPager2" CloneFrom="AspNetPager1">
                                            </webdiyer:AspNetPager>
                                        </div>
                                </ContentTemplate>
                            </asp:UpdatePanel>
                        </div>
                    </div>
                </div>
            </div>
        </div>
        <uc2:Foot runat="server" ID="FootUC" />

        <div id="editbox" style="display: none;">
            <div class="content" style="width: 500px; padding:20px;">
                <div class="hor-scroll">
                    <input type="hidden" value="0" id="hfdataid" />
                    <input type="hidden" value="0" id="hfpid" />
                    <table class="form-list postdata" cellspacing="0">
                        <tbody>
                            <tr>
                                <td class="left_td">
                                    <label for="_accountprefix">
                                        名称<span class="required">*</span></label>
                                </td>
                                <td class="value">
                                    <asp:TextBox runat="server" ID="tbclassnamesub" CanBeNull="必填" Width="200px" class="j_text" reg="\S" tip="名称不能为空"></asp:TextBox>
                                </td>

                            </tr>
                            <tr>
                                <td class="left_td">
                                    <label for="_accountfirstname">
                                        排序 <span class="required">*</span></label>
                                </td>
                                <td class="value">
                                    <asp:TextBox runat="server" ID="tbPriority" RequiredFieldType="数据校验" Text="1"
                                        CanBeNull="必填" Width="50px" class=" required-entry required-entry input-text" reg="^\d+$" tip="排序格式错误,请输入整数"></asp:TextBox><div
                                            class="mynotice">
                                            数字大，排在前。
                                        </div>
                                </td>

                            </tr>

                            <tr>
                                <td class="left_td">&nbsp;
                                </td>
                                <td class="value">

                                    <input type="button" value="保存" class="button_1" onclick="adddevicesort()" />
                                </td>

                            </tr>

                        </tbody>
                    </table>
                </div>
            </div>
        </div>

    </form>
</body>
</html>

<script src="../../javascript/jbox/jquery.jBox-2.3.min.js"></script>

<script type="text/javascript">
    //提交数据
    function adddevicesort() {
        var pid = $("#hfpid").val();
        var dataid = $("#hfdataid").val();
        var flag = j_submitdata("postdata");
        if (flag == false) {
            return;
        }
        showload_super();
        var para = "name=" + escape($("#tbclassnamesub").val()) + "&pri=" + escape($("#tbPriority").val()) + "&method=adddevicesort&id=" + dataid + "&pid=" + pid;

        jQuery.ajax(
        {
            type: "post",
            url: "/ajaxHandler.ashx",
            data: para,
            success: function (msg) {
                hideload_super();
                if (msg == "0") {
                    alert("添加失败，请联系管理员");
                    return;
                }
                else {
                    alert("操作成功");
                    window.location = window.location.href;
                }
            }
        })
    }

    //添加或者编号分类，dataid为0表示添加
    function startEdit(pid, dataid, name, pri) {

        var title = "添加费用科目";
        if (dataid != 0) {
            title = "编辑费用科目";
        }

        $.jBox('id:editbox', { buttons: {}, title: title, closed: function () { gourl('sysaccounts.aspx') } });
        $("#editbox").empty();

        //表示是编辑
        if (typeof name != 'undefined')
        {
            $("#tbclassnamesub").val(name);
            $("#tbPriority").val(pri);
        }

        $("#hfpid").val(pid);
        $("#hfdataid").val(dataid);
    }

</script>
